<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
    <link rel="stylesheet" href="js/layui/css/layui.css" media="all">
    <title>服务网点</title>
    <style>
        body {
            margin-top: 20px;
        }

        .layui-row {
            border-bottom: 1px solid #ddd;
            width: 90%;
            margin: 0 auto;
            margin-top: 10px;
            padding-bottom: 10px;

        }

        .back {
            margin-bottom: 30px;
            text-align: left;
        }

        h3 {
            margin: 15px 0 5px 0;
            font-size: 20px;
        }

        p {
            display: block;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            margin: 5px 0;
            color: #222;
        }

        span {
            font-size: 12px;
            color: #999;
        }

        span + span {
            margin-left: 10px;
        }
    </style>
</head>
<body>
<div class="back">
    <button type="button" id="backBtn" class="layui-btn layui-btn-sm layui-btn-primary" style="border: none;">
        <i class="layui-icon layui-icon-left">返回</i>
    </button>
</div>

<div>
    <!--搜索框-->
    <form class="layui-form">
        <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
        <div class="layui-form-item" style="margin-bottom: 5px;">
            <div class="layui-input-block" style="margin-left: 5px;margin-top: 5px;">
                <input type="text" name="title" autocomplete="off" class="layui-input"
                       style="width:70% ;display: inline-block;border: 1px #009F95 solid;">
                <button id="search-btn" class="layui-btn" lay-submit lay-filter="formDemo"
                        style="margin-top: -5px;width: 25%;border-radius: 10px;">搜索
                </button>
            </div>
        </div>
    </form>
    <div id="layui-row-content">
    </div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/common.js"></script>
<script>
    $(function () {

        $("#backBtn").on("click", function () {
            window.location.href = "index.html";
        });

        init();
    });

    function init() {
        $.ajax({
            url: baseUrl + "service/list.json",
            contentType: "json",
            success: function (data) {
                if (data.code == "200") {
                    var serviceList = data.pageInfo.list;
                    serviceList.forEach(function (service) {
                        $("#layui-row-content").append("<div class=\"layui-row\">\n" +
                            "            <a href=\"service-network-info.html?id="+service.id+"\">\n" +
                            "                <div>\n" +
                            "                    <h3>"+service.name+"</h3>\n" +
                            "                    <div>\n" +
                            "                        <span>联系电话："+service.phone+"</span>\n" +
                            "                    </div>\n" +
                            "                    <div>\n" +
                            "                        <span>地址:"+service.address+"</span>\n" +
                            "                    </div>\n" +
                            "                </div>\n" +
                            "            </a>\n" +
                            "        </div>");
                    });
                }
            }
        });
    }

</script>
</body>
</html>
